<template>
	<view>
		<!-- 课程讨论 -->
		<p class="topic_title">提出话题：</p>
		<u--textarea confirmType="done" v-model="value" placeholder="输入话题内容…" count></u--textarea>
		<u-button @click="release" type="success" text="确认发布"></u-button>
		<!-- u-popup -->
		<u-popup mode="center" :show="show" @open="open">
			<view class="popup_text">话题发布成功</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value: '',
				// u-popup
				show: false,
			}
		},
		methods: {
			// u-popup
			open() {
				console.log('open');
			},
			// 发布
			release() {
				this.show = true
				console.log(this.value)
				let a = {
					source: '王昕',
					see: '2000',
					join: '100',
					topic: this.value,
				}
				this.$api.lfyAddDiscuss(a).then(res => {
					this.show = false
					this.$api.lfycoursediscuss().then(res => {
						this.discuss = res.data
						// uni.navigateBack()({
						// 	url: '/pages/Home/lfyCourseTopic'
						// })
					})
				})
				
			},


		}
	}
</script>

<style lang="scss">
	* {
		margin: 0;
		padding: 0;
	}

	.topic_title {
		color: #171717;
		font-size: 32upx;
		height: 80upx;
		line-height: 80upx;
		padding: 0 20upx;
	}

	/deep/ .u-textarea {
		width: 90%;
		height: 300upx;
		margin: 0 auto;
	}

	/deep/.u-button--success {
		background-color: #8fc31f;
		width: 95%;
		margin: 100upx auto;
	}

	// Popup 弹出层
	/deep/ .u-popup__content {
		border-radius: 20upx;
		width: 80%;
	}

	.popup_text {
		height: 80upx;
		line-height: 80upx;
		text-align: center;
	}
</style>
